<script setup>
import { RouterLink, RouterView } from "vue-router";
import { onMounted } from "vue";

onMounted(() => {
  console.log("href", window.location.href);
});
</script>

<template>
  <router-view v-slot="{ Component }">
    <transition name="slide-fade" mode="out-in">
      <component :is="Component"></component>
    </transition>
  </router-view>
  <footer>
    <nav class="tab-wrapper" v-show="!$route.meta.hideTabBar">
      <RouterLink
        active-class="active"
        class="tab"
        :class="{ active: $route.path.startsWith('/film/') }"
        to="/film"
      >
        <span><i class="fa fa-toggle-right"></i></span>
        <span>电影</span>
      </RouterLink>
      <RouterLink active-class="active" class="tab" to="/cinema">
        <span><i class="fa fa-bank"></i></span>
        <span>影院</span>
      </RouterLink>
      <RouterLink active-class="active" class="tab" to="/news">
        <span><i class="fa fa-volume-up"></i></span>
        <span>资讯</span>
      </RouterLink>
      <RouterLink active-class="active" class="tab" to="/mine">
        <span><i class="fa fa-user-circle"></i></span>
        <span>我的</span>
      </RouterLink>
    </nav>
  </footer>
</template>
<style scoped>
footer {
  position: fixed;
  bottom: 0;
  width: 100%;
}

.tab-wrapper {
  display: flex;
  flex-direction: row;
  border-top: 1px solid #eee;
  background-color: white;
}

.tab {
  flex-grow: 1;
  height: 49px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  font-size: 12px;
}

.tab.active > span,
.tab.active > span > i {
  color: #ff5f16;
}

.tab .fa {
  font-size: 20px;
}

.tab > span {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #888;
}
/* 动画 */
.slide-fade-enter-active,
.slide-fade-leave-active {
  transition: all 0.5s ease;
}
.slide-fade-enter-from,
.slide-fade-leave-to {
  opacity: 0;
  transform: translateY(20px);
}
</style>
